Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APP-7692] Fix empty config errors on new install #73

Merged
merged 11 commits into from
Feb 24, 2025
Merged

Conversation

Otterverse
Copy link
Member

Default config wasn't being properly loaded on brand new installs with no cache. This only affects devices which are entirely offline at the time of install and rely on provisioning to get credentials (e.g. manufacturer preinstallation.)

Test build is here: http://packages.viam.com/temp/viam-agent-v0.14.1-rc1-aarch64

Manually copy it to an offline pi (with no existing /opt/viam) and run it with --install. Previously it would fail to enter provisioning. Now it should (as expected.)

Comment on lines +198 to +200
if errors.Is(err, fs.ErrNotExist) {
return StackConfigs(&pb.DeviceAgentConfigResponse{})
} else {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the actual fix.

Comment on lines +134 to +136
if err != nil {
globalLogger.Errorf("error loading config from cache: %w", err)
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be non-fatal always now.

Comment on lines +42 to +44
FragmentId: n.Config().FragmentID,
Model: n.Config().Model,
Manufacturer: n.Config().Manufacturer,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's one fix in config.go, the rest is a related fix around config locking (potential race.) Overlooked during 0.14.0 development.

Copy link
Member

@maxhorowitz maxhorowitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx!

@Otterverse Otterverse changed the title Fix empty config errors on new install [APP-7692] Fix empty config errors on new install Feb 24, 2025
Comment on lines 31 to 40
state, reason, err := wifiDev.GetPropertyStateReason()
if err != nil {
return errw.Wrap(err, "getting wifi state and reason")
}

if state != gnm.NmDeviceStateDisconnected && state != gnm.NmDeviceStateActivated {
n.logger.Debugf("wifi device state: %s, reason: %s, skipping scan", state, reason)
return nil
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should help reduce the flood of "Scanning not allowed while unavailable" messages Eliot and Bill reported.

@Otterverse Otterverse merged commit 6b65133 into main Feb 24, 2025
3 checks passed
@Otterverse Otterverse deleted the fix-emptyconfg branch February 24, 2025 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants